package com.jar.exercise.关于String的面试题;

/**
 * 字符串相加用“+”和append()的区别
 */
public class Demo1 {
	public static void main(String[] args) {
		String a = "a";
		String ab = "ab";
		String bc = "bc";
		String c = "c";
		String abc1 = a + bc;
		String abc2 = ab + c;
		System.out.println(abc1 == abc2);
		String abc3 = "a" + "bc";
//这几行
		String abc4 = "ab" + "c";
//都是使用
		String abc5 = "a" + "b" + "c";//常量相加的
		System.out.println(abc3 == abc4);
		System.out.println(abc4 == abc5);

	}
}
